package com.anxin.struts.action;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.anxin.bean.User;
import com.anxin.service.UserService;
import com.opensymphony.xwork2.ActionContext;

@Controller
@Scope("prototype")
public class UserAction extends BaseAction {
	private UserService service;
	private User user;

	public String login() {
		user = service.checkLogin(user);
		if (user != null) {
			ActionContext.getContext().getSession().put("user", user);
			return "success";
		} else {
			this.addActionMessage("�û�����������!");
			return "input";
		}
	}

	public UserService getService() {
		return service;
	}

	@Autowired
	public void setUserService(UserService service) {
		this.service = service;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
}
